import { defineStore } from 'pinia';

export const useDoctorFollowStore = defineStore('doctorFollow', {
  state: () => ({
    followedDoctors: []
  }),
  actions: {
    addFollowedDoctor(doctor) {
      // 检查医生是否已经关注，避免重复添加
      if (!this.followedDoctors.some(d => d.id === doctor.id)) {
        this.followedDoctors.push(doctor);
      }
    },
    removeFollowedDoctor(doctorId) {
      this.followedDoctors = this.followedDoctors.filter(d => d.id !== doctorId);
    }
  }
});
